﻿using System;
using System.Windows;
using System.Windows.Data;

namespace Tfs.OnTheRoad.Converters
{
    /// <summary>
    /// Returns a Visibility Attribute checking if the given value has a value to show
    /// </summary>
    public class FieldHasValueVisibilityConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null || (value!=null && string.IsNullOrEmpty(value.ToString().Trim())))
                return Visibility.Collapsed;
            else
                return Visibility.Visible;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}